/*
 * Copyright 2023-2023 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package net.yun789.javasipweb.user.context;

import net.yun789.javasipweb.dto.LoginUserDTO;

import javax.sip.message.Request;

/**
 * 登陆用户存储
 * @author ydy
 */
public interface UserContextRepository {


    /**
     * 获取登陆信息
     * @param request
     * @return
     */
    LoginUserDTO loadContext(Request request);

    /**
     * 保存登陆信息
     * @param loginUser
     * @param request
     */
    void saveContext(LoginUserDTO loginUser,Request request);

    /**
     * 是否有登陆信息
     * @param request
     * @return
     */
    boolean containsContext(Request request);

    /**
     * 根据通信地址获取用户
     * @param uriStr
     * @return
     */
    LoginUserDTO loadContext(String uriStr);

    /**
     * 注销
     * @param request
     */
    void logOff(Request request);

    /**
     * 登陆
     * @param request
     */
    boolean login(Request request);
}
